﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ZX.Web.UI.Controls;
using ZX.DBModule;
using ZX.BLL.Extend;
using ZX.Common;
using ZX.CRM.Library;
namespace ZX.WebApp.Crm.MeetingArrange
{
    public partial class CourseLayoutDetail:ListPage
    {
        /// <summary>
        /// 获取产品名称
        /// </summary>
        private string _productName;
        public string ProductName
        {
            get
            {
                return _productName;
            }
            set
            {
                _productName = value;
            }
        }
        /// <summary>
        /// 是否编辑
        /// </summary>
        private string _isEdit;
        public string isEdit
        {
            get
            {
                return _isEdit;
            }
            set
            {
                _isEdit = value;
            }
        }
        /// <summary>
        /// 页面标题
        /// </summary>
        public string PageTitle
        {
            get { return this.GetStringFromQueryString("title", ""); }
        }
        protected void Page_Load(object sender, EventArgs e)
        {  
            string courseLayoutId = this.GetStringFromQueryString("id", "");//课程规划ID
            string productId = this.GetStringFromQueryString("productId", "");//产品ID
            BaseEntity instance=null;
            if (courseLayoutId != string.Empty)
            {  //修改
                BaseBussnies<CrmProductLayout> binstance = new BaseBussnies<CrmProductLayout>();
                CrmProductLayout courseLayout = new CrmProductLayout();
                binstance.entity = courseLayout;
                courseLayout = binstance.GetEntityById<CrmProductLayout>(Guid.Parse(courseLayoutId));
                instance = courseLayout as BaseEntity;
                productId = courseLayout.ProductID.ToString();
                isEdit = "True";
                
            }
            else
            {   //新增
                instance = ZX.Common.Globals.getEntity("CrmProductLayout") as BaseEntity;
                isEdit = "False";
            }
            this.EditTemplate.Text =ZX.WebApp.Crm.Common.CreateJson.CreateHtml(instance, null);


            BaseBussnies<CrmProduct> bll = new BaseBussnies<CrmProduct>();
            CrmProduct product = new CrmProduct();
            bll.entity = product;
            //得到产品名称
            product = bll.GetEntityById<CrmProduct>(new Guid(productId));
            ProductName = product.Caption;
            
        }
     
    }
}